
<template>
	<view class="wayinfoBox" v-if="!loading">
		<view class="tabCon">
			<h5>当前配载单状态</h5>
			<view class="wayUl">
				<u-skeleton
					   rows="5"
					   rowsWidth="696rpx"
					   rowsHeight="34rpx"
						titleWidth="696rpx"
						titleHeight="34rpx"
						:loading="loading" >
					<view class="tabLi" v-show="false">
						运单号： <span>{{wayBillInfoDate.waybillInfo.billNo}}</span>
					</view>
					<view class="tabLi">
						运单号： <span>{{wayBillInfoDate.waybillInfo.billNo}}</span>
					</view>
					<view class="tabLi">
						网络承运商： <span>{{wayBillInfoDate.waybillInfo.platformCoName}}</span>
					</view>
					<view class="tabLi">
						承运商： <span>{{wayBillInfoDate.waybillInfo.carrierName}}</span>
					</view>
					<!-- <view class="tabLi">
						运单模式：<span>暂无</span>
					</view> -->
					<view class="tabLi">
						业务类型： <span>{{getBizType(wayBillInfoDate.waybillInfo.bizType)}}</span>
					</view>
					<view class="tabLi">
						计划运输时间： <span>{{changeTimeFormat(wayBillInfoDate.waybillInfo.planBeginTime)}}</span>
					</view>
					<view class="tabLi">
						计划送达时间： <span>{{changeTimeFormat(wayBillInfoDate.waybillInfo.planEndTime)}}</span>
					</view>
					<view class="tabLi">
						计划运输数量： <span>{{wayBillInfoDate.waybillInfo.planShippingNum}} {{unit}}</span>
					</view>
					<!-- <view class="tabLi">
						实发数量： <span>{{wayBillInfoDate.waybillInfo.shippedNum}} {{unit}}</span>
					</view>
					<view class="tabLi">
						实卸数量： <span>暂无</span>
					</view>
					<view class="tabLi">
						实际货差： <span>暂无</span>
					</view>
					<view class="tabLi">
						实际货损率： <span>暂无</span>
					</view> -->
				</u-skeleton>
			</view>
		</view>
		<view class="tabCon">
			<h5>货物信息</h5>
			<view class="wayUl">
				<u-skeleton
					   rows="3"
					   rowsWidth="696rpx"
					   rowsHeight="34rpx"
						titleWidth="696rpx"
						titleHeight="34rpx"
						:loading="loading" >	
					<view class="tabLi">
						货物名称： <span>{{wayBillInfoDate.goodsInfo.goodsName}}</span>
					</view>
					<view class="tabLi">
						货物类型： <span>{{getGoodsType(wayBillInfoDate.goodsInfo.goodsType)}}</span>
					</view>
					<view class="tabLi">
						计量单位： <span>{{unit}}</span>
					</view>
					<view class="tabLi">
						计划运输量： <span>{{wayBillInfoDate.goodsInfo.planShippingNum}}</span>
					</view>
					<view class="tabLi">
						运输单价： <span>{{wayBillInfoDate.goodsInfo.shippingPrice}}</span>
					</view>
					<view class="tabLi" style="height: auto;overflow: hidden">
						货损指标： 
						<span style="width: 70%;text-align: right;">
						{{wayBillInfoDate.waybillInfo.damageRate || wayBillInfoDate.waybillInfo.briefIntroduction }}
						{{ wayBillInfoDate.waybillInfo.damageRate?'‰':'' }}
						</span>
					</view>
				</u-skeleton>
			</view>
		</view>
	
		<view class="tabCon">
			<h5>托运人信息</h5>
			<view class="wayUl">
				<u-skeleton
					   rows="5"
					   rowsWidth="696rpx"
					   rowsHeight="34rpx"
						titleWidth="696rpx"
						titleHeight="34rpx"
						:loading="loading" >
				<view class="tabLi">
					托运人单位： <span>{{wayBillInfoDate.consignmentInfo.shippingUserNnit}}</span>
				</view>
				<view class="tabLi">
					托运人： <span>{{wayBillInfoDate.consignmentInfo.shippingUserName}}</span>
				</view>
				<view class="tabLi">
					手机号： <span>{{wayBillInfoDate.consignmentInfo.shippingUserTel}}</span>
				</view>
				<view class="tabLi">
					取货城市： <span>{{wayBillInfoDate.consignmentInfo.shippingCity}}</span>
				</view>
				<view class="tabLi">
					详细地址： <span>{{wayBillInfoDate.consignmentInfo.shippingAddress}}</span>
				</view>
				</u-skeleton>
			</view>
		</view>
		<view class="tabCon">
			<h5>收货人信息</h5>
			<view class="wayUl">
				<u-skeleton
					   rows="5"
					   rowsWidth="696rpx"
					   rowsHeight="34rpx"
						titleWidth="696rpx"
						titleHeight="34rpx"
						:loading="loading" >
				<view class="tabLi">
					收货人单位： <span>{{wayBillInfoDate.receiptInfo.receiptUserNnit}}</span>
				</view>
				<view class="tabLi">
					收货人： <span>{{wayBillInfoDate.receiptInfo.receiptUserName}}</span>
				</view>
				<view class="tabLi">
					手机号： <span>{{wayBillInfoDate.receiptInfo.receiptUserTel}}</span>
				</view>
				<view class="tabLi">
					收货城市： <span>{{wayBillInfoDate.receiptInfo.receiptCity}}</span>
				</view>
				<view class="tabLi">
					详细地址： <span>{{wayBillInfoDate.receiptInfo.receiptAddress}}</span>
				</view>
				</u-skeleton>
			</view>
		</view>
	</view>
	
</template>

<script>
	import {
		wayBillDataBulletinBoard,
		carriers,
		wayBillInfo,
		getLoadingOrders,
		queryDicByDicType,
		updateWayBillMold,
		queryDicKey
	} from '@/config/api/app.js'
	export default{
		data(){
			return{
				wayBillInfoDate:{},
				unit:'',
				loading: this.loading1
			}
		},
		props:{
			wayBillId:{
				type:String
			},
			loading1: {
				type: Boolean
			},
		},
		mounted() {
			this.getWayBillInfo()
		},
		methods:{
			//运单信息详情
			 getWayBillInfo() {
				wayBillInfo({
					wayBillId: this.wayBillId
				}).then(res => {
					if (res.code == 0) {
						
						
						this.wayBillInfoDate = res.data
						 this.getQueryDicKey()
						this.loading = false
					} else {
						this.$refs.uToast.show({
							message: res.message
						})
					}
				})
			},
			//查询字段
			 getQueryDicKey() {
				let arr = [
					"BIZ_TYPE",
					"CARGO_TYPE",
					"PRC_MODE",
					"WAYBILL_MODE",
					"WAYBILL_STATUS",
					"UNIT"
				]
				queryDicKey(arr,
				// {
				// 	custom: {
				// 		title: '查询字段数据……'
				// 	}
				// },
				).then(res => {
					if (res.code == 0) {
						this.listActivity = res.data.BIZ_TYPE
						this.listGoodsType = res.data.CARGO_TYPE
						this.unitList = Object.values(res.data.UNIT)
						console.log(this.wayBillInfoDate.goodsInfo)
						this.unit =  this.getUnitType(this.wayBillInfoDate.goodsInfo.unit)
					} else {
						uni.$u.toast(res.msg);
					}
				}).catch(err => {
					console.log(err)
				})
			},
			//业务类型
			getBizType(value){
				for(let key in this.listActivity){
				    if(value == key) return this.listActivity[key].dicName
			
				}
			},
			//计量单位
			getUnitType(value){
				for(let item of this.unitList){
				    if(value == item.dicValue) return item.dicName
				
				}
			},
			//货物类型
			getGoodsType(value){
				for(let key in this.listGoodsType){
				    if(value == key) return this.listGoodsType[key].dicName
				}
			},
			changeTimeFormat: function(time) {
				var date = new Date(time);
				var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
				var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
				var hh = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
				var mm = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
				return date.getFullYear() + "-" + month + "-" + currentDate + " " + hh + ":" + mm;
				//返回格式：yyyy-MM-dd hh:mm
			},
		}
	}
</script>

<style lang="less">
	.wayinfoBox {
		background: #FFFFFF;
		margin-top: 14rpx;
	
		.tabCon {
			background: #FFFFFF;
			border-bottom: 14rpx solid #FAFAFA;
	
			.wayUl {
				padding: 0 28rpx;
				.tabLi {
					height: 68rpx;
					line-height: 68rpx;
					
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #888888;
	
					span {
						float: right;
						font-family: PingFangSC-Medium, PingFang SC;
						font-weight: 600;
						color: #333333;
					}
				}
	
				.tabLi.tabLi:nth-child(2n-1) {
					background: #FBFBFB;
				}
			}
		}
	
		h5 {
			height: 36rpx;
			font-size: 30rpx;
			font-family: PingFangSC-Semibold, PingFang SC;
			font-weight: 600;
			color: #333333;
			line-height: 36rpx;
			border-left: 8rpx solid #003E81;
			padding-left: 14rpx;
			margin: 28rpx 0 20rpx;
		}
	}
	
</style>